package com.example.demo;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurationSupport;

/**
 * spring boot 读取配置文件的几种方式
 * @author jiaqi.liu
 *
 */
@SpringBootApplication
//@EnableConfigurationProperties({PropsConfig.class,YmlConfig.class})
public class PropsApplication extends WebMvcConfigurationSupport {

	public static void main(String[] args) {
		SpringApplication.run(PropsApplication.class, args);
	}
	
	/**
	 * swagger2资源文件映射配置
	 * @param registry
	 */
	public void addResourceHandlers(ResourceHandlerRegistry registry) {
		
		registry.addResourceHandler("swagger-ui.html")
        .addResourceLocations("classpath:/META-INF/resources/");

       registry.addResourceHandler("/webjars/**")
        .addResourceLocations("classpath:/META-INF/resources/webjars/");
	}
		
}
